package cn.hongyu.config;

import cn.hongyu.pojo.User;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@ComponentScan("cn.hongyu")
@PropertySource(value = "classpath:user.properties",encoding = "utf-8")
public class MVCConfigration {
    @Value("${user.userName}")
    private String name;
    @Value("${user.userId}")
    private Integer id;

    @Bean("user")
    public User getUser(){
        User user = new User();
        user.setUserId(id);
        user.setUserName(name);
        return user;
    }
}
